# ifndef __PropertyPages_H_
# define __PropertyPages_H_

# include "Dialog.h"

class CPropertyPages {
	// Disable copy semantics.
	CPropertyPages (const CPropertyPages &);
	void operator = (const CPropertyPages &);

  public:
	CPropertyPages () {}
	~CPropertyPages ();

	class CPage : public CDialogBase {
	  public:
		CPage (WORD _wResID) : CDialogBase (_wResID), m_pPP (NULL) {}

		virtual void OnActivatePage (const PSHNOTIFY *) {}
		virtual void OnApply        (const PSHNOTIFY *) {}

		// Override.
		virtual bool OnNotify (int _idCtrl, NMHDR * _pInfo);

		void PropSheetChanged () {PropSheet_Changed (::GetParent (m_hWnd), m_hWnd);}

	  protected:
		CPropertyPages * GetPP () const {return m_pPP;}
		HWND GetPage (size_t _cPageIdx);

		friend class CPropertyPages;
	  private:
		static INT_PTR CALLBACK _DlgProc (HWND _hWnd, UINT _uMsg, WPARAM _wParam, LPARAM _lParam);

		CPropertyPages * m_pPP;
	};

	void AddPage (CPropertyPages::CPage * _pPage);

	void ShowModal (HWND _hWndParent, WORD _wResCaptionID, int _nStartPage = 0);

	size_t GetPages () const {return m_vecPages.size ();}
	CPage * GetPage (size_t _cPage) {return m_vecPages [_cPage];}

  protected:
	std::vector<CPage *> m_vecPages;

  private:
	static int CALLBACK _TabSheetProc (HWND _hWnd, UINT _uMsg, LPARAM _lParam);
};

void CenterPropertyPages (HWND _hPage);

# endif // __PropertyPages_H_